/*
 * JanelaPrincipal.java
 *
 * Created on 13 de Junho de 2008, 14:05
 */

package gui_TJCPS;

import java.awt.Color;

import com.domus.dreamMenu.cliente.core.Fachada;
import com.domus.dreamMenu.tipos.Idioma;

/**
 *org.jdesktop.swingx.JXCollapsiblePane
 * @author  tjcps
 */
public class JanelaPrincipal extends javax.swing.JFrame {
	/**
	 * 
	 */
	private static PainelPrincipal painelPrincipal;
	private Color corPreta;
	private Color corVerde;
	private Color corVermelha;
	public static final int larguraJanela = 1024;
	public static final int alturaJanela = 768;
	public Fachada fachada;
	private PainelAjuda painelAjuda;
	private PainelEncerrarAtendimento painelPedirConta;
	private PainelConfirmacaoPedirConta painelConfirmacaoPedirConta;
	private PainelInicio painelInicio;
	private PainelInfo painelInfo;
	private TelaDeNoticia telaNoticia;
	private static PainelListaPedidos painelListaPedidos;
	
	
	public static void esconderListaPedidos(){
		painelListaPedidos.setVisible(false);
		painelPrincipal.setVisible(true);
		
	}
	
	public JanelaPrincipal() {
		this.setLayout(null);
		this.setSize(1024, 768);
		this.setResizable(false);
		this.setBackground(new Color(0,0,0));
		this.setUndecorated(true);
		this.setAlwaysOnTop(true);
		this.setBackground(this.corPreta);
		this.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
		
		this.initComponents();
		this.exibirTelaInicialMichelli();

		this.setVisible(true);
	}
	
	private void initComponents() {
		this.fachada = new Fachada();
		this.painelInicio = new PainelInicio(this);
		this.painelInicio.setBounds(0,0,this.larguraJanela,this.alturaJanela);
		this.painelInicio.setVisible(false);
		this.add(this.painelInicio);
		
		this.painelPrincipal = new PainelPrincipal(this,this.larguraJanela, this.alturaJanela, this.fachada);
		this.painelPrincipal.setBounds(0,0,this.larguraJanela, this.alturaJanela);
		this.painelPrincipal.setVisible(false);
		this.add(this.painelPrincipal);
		//this.getContentPane().add(this.painelPrincipal);
		
		this.painelAjuda = new PainelAjuda(this);
		this.painelAjuda.setBounds(0,0,1024,768);
		this.painelAjuda.setVisible(false);
		this.add(this.painelAjuda);		
	
		this.painelPedirConta = new PainelEncerrarAtendimento(this);
		this.painelPedirConta.setBounds(0,0,1024,768);
		this.painelPedirConta.setVisible(false);
		this.add(this.painelPedirConta);
	
		this.painelConfirmacaoPedirConta = new PainelConfirmacaoPedirConta();
		this.painelConfirmacaoPedirConta.setBounds(0,0,1024,768);
		this.painelConfirmacaoPedirConta.setVisible(false);
		this.add(this.painelConfirmacaoPedirConta);
		
		this.painelInfo = new PainelInfo(this);
		this.painelInfo.setBounds(0,0,this.larguraJanela, this.alturaJanela);
		this.painelInfo.setVisible(false);
		this.add(this.painelInfo);
		
		this.painelListaPedidos = new PainelListaPedidos(this);
		this.painelListaPedidos.setBounds(0,0,1024,768);
		this.painelListaPedidos.setVisible(false);
		this.add(this.painelListaPedidos);
	}

	public void exibirTelaInicialMichelli(){
		this.painelPrincipal.setVisible(false);
		this.painelAjuda.setVisible(false);
		this.painelConfirmacaoPedirConta.setVisible(false);
		this.painelInfo.setVisible(false);
		this.painelPedirConta.setVisible(false);
		this.painelListaPedidos.setVisible(false);
		this.painelInicio.setVisible(true);
	}
	
	public void exibirTelaAjuda() {
		this.painelPrincipal.setVisible(false);
		this.painelConfirmacaoPedirConta.setVisible(false);
		this.painelInfo.setVisible(false);
		this.painelPedirConta.setVisible(false);
		this.painelInicio.setVisible(false);
		this.painelListaPedidos.setVisible(false);
		this.painelAjuda.setVisible(true);
	}

	public void exibirTelaPedirConta() {
		this.painelPrincipal.setVisible(false);
		this.painelAjuda.setVisible(false);
		this.painelConfirmacaoPedirConta.setVisible(false);
		this.painelInfo.setVisible(false);
		this.painelInicio.setVisible(false);
		this.painelListaPedidos.setVisible(false);
		this.painelPedirConta.setVisible(true);
	}
	
	public void exibirPainelInfo(){
		this.painelInfo.mudarBotoes();
		this.painelAjuda.setVisible(false);
		this.painelConfirmacaoPedirConta.setVisible(false);
		this.painelInicio.setVisible(false);
		this.painelPedirConta.setVisible(false);
		this.painelPrincipal.setVisible(false);
		this.painelListaPedidos.setVisible(false);
		this.painelInfo.setVisible(true);
	}
	
	public void exibirPainelPrincipal(){
		this.painelAjuda.setVisible(false);
		this.painelConfirmacaoPedirConta.setVisible(false);
		this.painelInfo.setVisible(false);
		this.painelPedirConta.setVisible(false);
		this.painelInicio.setVisible(false);
		this.painelListaPedidos.setVisible(false);
		this.painelPrincipal.setVisible(true);
	}
	
	public void exibirPainelListaPedidos(){
		this.painelAjuda.setVisible(false);
		this.painelConfirmacaoPedirConta.setVisible(false);
		this.painelInfo.setVisible(false);
		this.painelPedirConta.setVisible(false);
		this.painelInicio.setVisible(false);
		this.painelPrincipal.setVisible(false);		
		this.painelListaPedidos.setVisible(true);
	}
	
	public void acaoBotaoAjuda(){
		this.exibirTelaAjuda();
	}

	public void acaoBotaoPedirContaConfirmacao(){
		this.exibirTelaPedirConta();
	}
	
	public void acaoBotaoPedirContaNaoConfirmacao(){
		this.exibirPainelPrincipal();
	}
	
	public void setIdioma(Idioma idioma){
		this.fachada.setIdioma(idioma);
		//o correto seria recarregar essa tela com as informacoes em ingles.
	}

	public PainelPrincipal getPainelPrincipal() {
		return painelPrincipal;
	}

	public PainelListaPedidos getPainelListaPedidos() {
		return painelListaPedidos;
	}

	public void exibirPainelNoticias() {
//		this.painelAjuda.setVisible(false);
//		this.painelConfirmacaoPedirConta.setVisible(false);
//		this.painelInfo.setVisible(false);
//		this.painelPedirConta.setVisible(false);
//		this.painelInicio.setVisible(false);
//		this.painelPrincipal.setVisible(false);		
//		this.painelListaPedidos.setVisible(false);
		this.telaNoticia = new TelaDeNoticia(this.fachada, this);
		this.setVisible(false);
		this.telaNoticia.JframeNoticias.setVisible(true);
	}
	
}
